package com.zykj.spb.study.service.user;

import com.zykj.spb.study.entity.user.User;
import com.zykj.spb.study.mapper.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @author zhoulj(周利军) [1217102780@qq.com]
 * @Title: UserSerivceImple
 * @Project: ${MODEL_NAME}
 * @Module ID:   <(模块)类编号，可以引用系统设计中的类编号>
 * @Comments: <对此类的描述，可以引用系统设计中的描述>
 * @JDK version used:      <JDK1.8> 26
 * @since 2018/12/18-22:26
 */
@Service
public class UserSerivceImple implements IUserService {
    Logger logger = LoggerFactory.getLogger(UserSerivceImple.class);
    @Autowired
    UserMapper userMapper;
    @Override
    @Cacheable(value = "user" , key = "#id")
    public User getById(Integer id) {
        logger.debug("【缓存中无数据】 开始查询数据库...");
        return userMapper.selectByPrimaryKey(id);
    }
}
